package com.wnxy.pawnbackgroundsystem.controller;


import com.wnxy.pawnbackgroundsystem.dto.ShopDefineDto;
import com.wnxy.pawnbackgroundsystem.entity.ShopDefine;
import com.wnxy.pawnbackgroundsystem.response.Result;
import com.wnxy.pawnbackgroundsystem.service.impl.ShopDefineServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 商品鉴定图定义表 前端控制器
 * </p>
 *
 * @author Lucas
 * @since 2021-10-14
 */
@RestController
@RequestMapping("/pawnbackgroundsystem/shopdefine")
public class ShopDefineController {

    @Autowired
    private ShopDefineServiceImpl shopDefineServiceImpl;

    //带条件查询多个鉴定图定义
    @GetMapping("/getShopDefine")
    @CrossOrigin("*")
    public Result getShopDefine(Integer sortId){
        List<ShopDefineDto> shopDefine = shopDefineServiceImpl.getShopDefine(sortId);
        return new Result(true,"2002","查询集合成功",shopDefine);
    }
    @DeleteMapping("/delShopDefine")
    @CrossOrigin("*")
    public Result delShopDefine(Integer defineId){
        System.out.println(defineId);
        shopDefineServiceImpl.delShopDefine(defineId);
        return new Result(true,"2002","删除成功",null);
    }
    //删除临时鉴定图定义
    @DeleteMapping("/delTimeDefine")
    @CrossOrigin("*")
    public Result delTimeDefine(){
        shopDefineServiceImpl.delTimeDefine();
        return new Result(true, "2002", "删除成功", null);
    }


}

